
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org"
      lang="en">
<head>
    <!-- Standard Meta 适配移动设备 -->
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <title th:text="'分类页 | '+ #{web_Name}"></title>
    <meta name="keywords" th:content="#{web_Keywords}">
    <meta name="description" th:content="#{web_Description}">
    <!--实现每日一言-->
    <script src="/js/bluebird.min.js"></script>
    <script src="/js/whatwg-fetch@2.0.3_fetch.js"></script>
    <!--End-->
    <script>
        fetch('https://v1.hitokoto.cn/?max_length=21')
            .then(function (res){
                return res.json();
            })
            .then(function (data) {
                var hitokoto = document.getElementById('hitokoto');
                hitokoto.innerText =data.hitokoto;
            })
            .catch(function (err) {
                console.error(err);
            })
    </script>
    <div th:replace="/fragments/header :: common-js"></div>

</head>
<body>

<div id="workingArea">
    <div th:replace="/fragments/header :: menu">
    </div>
    <div class="pageHeadContainer">
        <img src="../static/images/background/background5.jpg"  th:src="#{types_Background}" class="ui image backgroundImg">
        <div class="backgroundLayout">
            <div class="myInfoDiv" align="center">
                <div class="word" >
                    <br>
                    <div id="hitokoto"style="font-size:30px;color:#ffffff;">:D 获取中...</div>
                </div>
            </div>
        </div>
    </div>
    <div class="categoryContent">
        <div class="ui top attached segment">
            <div class="ui middle aligned two column grid">
                <div class="column">
                    <h3 class="ui violet header">分类</h3>
                </div>
                <div class="right aligned column">
                    <h2 class="ui orange header m-inline-block m-text-thin" th:text="共+${#arrays.length(types)}+个"> </h2>
                </div>
            </div>
        </div>

        <div class="ui attached segment m-padded-tb-large">
            <div class="ui labeled button m-margin-tb-tiny" th:each="type : ${types}">
                <a href="#" th:href="@{/types/{id}(id=${type.id})}" class="ui basic  button" th:classappend="${type.id==activeTypeId} ? 'violet'" th:text="${type.name}">思考与感悟</a>
                <div class="ui basic  left pointing label" th:classappend="${type.id==activeTypeId} ? 'violet'" th:text="${#arrays.length(type.blogs)}">24</div>
            </div>
        </div>

        <div class="ui top attached violet segment">
            <div class="ui padded vertical segment m-padded-tb-large" th:each="blog : ${pageInfo.list}">
                <div class="ui middle aligned mobile reversed stackable grid">
                    <div class="eleven wide column">
                        <h3 class="ui header" ><a href="#" th:href="@{/blog/{id}(id=${blog.id})}" target="_blank" class="m-black" th:text="${blog.title}">你真的理解什么是财富自由吗?</a></h3>
                        <p class="m-text" th:text="|${blog.description}......|">正确做好任何一件事情的前提是清晰、正确的理解目标。而事实是，我们很多人很多时候根本没有对目标正确的定义，甚至根本从来就没有想过，只是大家都那么做而已…...</p>
                        <div class="ui grid">
                            <div class="eleven wide column">
                                <div class="ui mini horizontal link list">
                                    <div class="item">
                                        <img src="https://unsplash.it/100/100?image=1005" th:src="@{${blog.user.avatar}}" alt="" class="ui avatar image">
                                        <div class="content"><a href="#" class="header" th:text="${blog.user.nickname}" >朱一鸣</a></div>
                                    </div>
                                    <div class="item">
                                        <i class="calendar icon"></i><span th:text="${#dates.format(blog.updateTime, 'yyyy-MM-dd')}">2020-3-02</span>
                                    </div>
                                    <div class="item">
                                        <i class="eye icon"></i> <span th:text="${blog.views}">2342</span>
                                    </div>
                                </div>
                            </div>
                            <div class="right aligned five wide column">
                                <a href="#" target="_blank" class="ui violet basic label m-padded-tiny m-text-thin" th:text="${blog.type.name}">认知升级</a>
                            </div>
                        </div>
                    </div>

                    <div class="five wide column">
                        <a href="#" th:href="@{/blog/{id}(id=${blog.id})}" target="_blank">
                            <img src="https://unsplash.it/800/450?image=1005" th:src="@{${blog.firstPicture}}"  alt="" class="ui rounded image">
                        </a>
                    </div>

                </div>
            </div>

        </div>
        <!--分页-->
        <div class="ui bottom attached segment m-opacity stackable grid">
            <div class="three wide column" align="center">
                <a class="item" th:href="@{/types(pageNum=${pageInfo.hasPreviousPage}?${pageInfo.prePage}:1)}" th:unless="${pageInfo.isFirstPage}">上一页</a>
            </div>

            <div class="ten wide column" align="center">
                <p> <span th:text="${pageInfo.pageNum}"></span> / <span th:text="${pageInfo.pages}"></span> </p>
            </div>

            <div class="three wide column" align="center">
                <a class="item" th:href="@{/types(pageNum=${pageInfo.hasNextPage}?${pageInfo.nextPage}:${pageInfo.pages})}" th:unless="${pageInfo.isLastPage}">下一页</a>
            </div>
        </div>

    </div>

    <button id="toTop" class="circular ui icon button" style="display: none;">
        <i class="ui caret up icon"></i>
    </button>

    </div>

<script type="text/javascript" src="/static/js/category.js" th:src="@{/js/category.js}"></script>

<div th:replace="/fragments/footer :: footer-content"></div>
</body>
</html>